package taskdto

import (
	"strconv"
	"xr-game-server/entity"
)

type TaskDto struct {
	TaskCfgId uint64   `json:"taskCfgId"`
	Status    uint8    `json:"status" dc:"状态 0 未完成 1 已完成 2已领取"`
	Param     []string `json:"param" dc:"任务完成进度列表"`
}

func NewTaskDto(task *entity.PlayerTask, details []*entity.PlayerTaskDetail) *TaskDto {
	taskDto := &TaskDto{
		TaskCfgId: task.TaskCfgId,
		Status:    task.Status,
		Param:     []string{},
	}
	for _, detail := range details {
		taskDto.Param = append(taskDto.Param, strconv.FormatUint(detail.Val, 10))
	}
	return taskDto
}
